package com.geek.resp;

import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class Response {

	public static final int CODE_SUCCESS = 200;
	public static final int CODE_FAIL = 500;

	private int code = CODE_SUCCESS;

	private Object data;

	private String message = "成功";

	public Response(){
	}

	public Response(int code){
		this.code = code;
	}

	public Response(int code, Object data){
		this.code = code;
		this.data = data;
	}

	public Response(int code, String message, Object data){
		this.code = code;
		this.data = data;
		this.message = message;
	}

	public void success(String message){
		this.setCode(CODE_SUCCESS);
		this.setMessage(message);
	}
	public void fail(String message){
		this.setCode(CODE_FAIL);
		this.setMessage(message);
	}

}
